﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="Gallery.aspx.cs" Inherits="Admin_Gallery" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Main_HeaderContentPlaceHolder" runat="Server">
    <link href="~/Guest/Gallery/css/visuallightbox.css" rel="stylesheet" type="text/css" />
    <link href="~/Guest/Gallery/css/vlightbox6.css" rel="stylesheet" type="text/css" />
    <script src="~/Guest/Gallery/js/visuallightbox.js" type="text/javascript"></script>
    <script src="~/Guest/Gallery/js/vlbdata6.js" type="text/javascript"></script>
    <script src="~/Guest/Gallery/js/jquery.min.js" type="text/javascript"></script>
    <link href="../App_Themes/Default/css/TableStyles.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        function CheckName(sender, e) {
            var maxUplouder = document.getElementById("<%=MaxPicFileUpload.ClientID %>");
            var minUplouder = document.getElementById("<%=MinPicFileUpload.ClientID %>");
            if (maxUplouder != "") {
                var maxFilepath = maxUplouder.value;
                var maxFilename = maxFilepath.substring(maxFilepath.lastIndexOf('\\') + 1).toLowerCase();
                var minFilepath = minUplouder.value;
                var minFilename = minFilepath.substring(minFilepath.lastIndexOf('\\') + 1).toLowerCase();
                if (minFilename != maxFilename) {
                    alert("نام دو تصویر باید یکسان باشد");
                    e.IsValid = false;
                    return;
                }
            }
            e.IsValid = true;
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Main_MainContentPlaceHolder" runat="Server">
           <table border="0" cellpadding="0" cellspacing="0" style="width: 500px">
            <tr valign="middle">
                <td style="width: 80px" align="right">
                    تصویر کوچک:
                </td>
                <td style="width: 380px" align="right" dir="rtl">
                    <asp:FileUpload ID="MinPicFileUpload" runat="server" Width="350px" />
                    <asp:RequiredFieldValidator ID="MinRequiredFieldValidator" runat="server" ErrorMessage="*"
                        ControlToValidate="MinPicFileUpload" ValidationGroup="Insert"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr valign="middle">
                <td style="width: 80px" align="right">
                    تصویر بزرگ:
                </td>
                <td style="width: 380px" align="right" dir="rtl">
                    <asp:FileUpload ID="MaxPicFileUpload" runat="server" Width="350px" />
                    <asp:RequiredFieldValidator ID="MaxRequiredFieldValidator" runat="server" ErrorMessage="*"
                        ControlToValidate="MaxPicFileUpload" ValidationGroup="Insert"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr valign="middle">
                <td style="width: 80px" align="right">
                </td>
                <td style="width: 380px" align="right" dir="rtl">
                    <asp:CustomValidator ID="fileNameCustomValidator" ValidationGroup="Insert" ControlToValidate="MaxPicFileUpload"
                        runat="server" ClientValidationFunction="CheckName" ErrorMessage="نام دو تصویر باید یکسان باشد"></asp:CustomValidator>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="left">
                    <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
                        <tr>
                            <td style="height: 15px">
                                &nbsp;
                            </td>
                            <td align="left" valign="top" style="width: 65px;">
                            </td>
                            <td align="left" valign="top" style="width: 65px;">
                            </td>
                        </tr>
                        <tr>
                            <td style="height: 15px">
                                &nbsp;
                            </td>
                            <td align="left" valign="top" style="width: 65px;">
                                <asp:ImageButton ID="InsertButton" runat="server" CommandName="Insert" SkinID="InsertButton"
                                    ValidationGroup="Insert" OnClick="InsertButton_Click" />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
        <br />
        <asp:MultiView ID="ImageMultiView" runat="server">
            <asp:View ID="NoFileView" runat="server">
                <p>
                    تصویری در مسیر فایل های گالری وجود ندارد
                </p>
            </asp:View>
            <asp:View ID="FileView" runat="server">
                <div style="overflow: auto; width: 90%; height: 300px; border-left: 1px gray solid;
                    border-bottom: 1px gray solid; padding: 0px; margin: 0px">
                    <asp:Table ID="ImageTable" runat="server">
                    </asp:Table>
                </div>
            </asp:View>
        </asp:MultiView>
</asp:Content>
